// 使用示例
loadScript('https://w1.hoopchina.com.cn/gamecenter/hupu-game-common-sdk.min.js', function(err) {
    if (err) {
        console.error('加载出错');
    } else {
        console.log('加载成功');
        // 在这里使用加载的库
        // 登录
        // 获取token
        window.HupuGameSdk.getAccessToken().then((data) => {
            console.log('获取到的token', data)
            hupu_login(data.data);
        })
        console.log("是否打开游戏：",open_game);
    }
});

function hupu_login(user_info){
    console.log("虎扑登录参数：",user_info);
    user_info.cid = cid;
    user_info.gid = gid;
    faXingLogin(user_info);
}

function getQueryParams() {
    var urlParams = new URLSearchParams(window.location.search);
    var params = {};
    for (var param of urlParams.entries()) {
        params[param[0]] = param[1];
    }
    return params;
}



function hupu_creterole(data){
    if(data.is_save == 0 ){
        window.HupuGameSdk.report({
            serverId: data.sid,
            roleId: data.role_id,
            roleName: data.role_name,
            createRoleTime: Math.floor(Date.now() / 1000),
        })
    }
    $.post(feihuo_creteroleUlr,data,function(info) {
        console.log("角色结果:",info);
    });
}



function hupu_pay(data){
    console.log("duoyou支付数据：",data);
    dy_jh_sdk.h5paySdk(data,function (result){
        console.log("duoyou发起支付");
    });
}
